// source --> https://givegetgigs.com/wp-content/plugins/accesspress-anonymous-post-pro/js/frontend.js?ver=3.1.0
function check_form_submittable(form_id)
{
if (jQuery('#' + form_id + ' .ap-captcha-type').val() == 'human')
{
var error_message = jQuery('#' + form_id + ' #ap-captcha-result').attr('data-required-msg');
if (error_message == '')
{
error_message = ap_captcha_error_message;
}
var first_num = jQuery('#' + form_id + ' .ap-captcha-first-num').html();
var second_num = jQuery('#' + form_id + ' .ap-captcha-second-num').html();
var result = parseInt(first_num) + parseInt(second_num);
var user_result = jQuery('#' + form_id + ' #ap-captcha-result').val();
if (result == user_result)
{
return true;
} else
{
jQuery('#' + form_id + ' .ap-captcha-error-msg').html(error_message);
return false;
}
return false;
} else if (jQuery('#' + form_id + ' .ap-captcha-type').val() == 'google')
{
if (jQuery('#' + form_id + ' .ap-captcha-version').val() == 'v1') {
challengeField = jQuery("input#recaptcha_challenge_field").val();
responseField = jQuery("input#recaptcha_response_field").val();
var html = jQuery.ajax({
type: "POST",
url: ap_fileuploader.upload_url,
data: "action=ap_validate_recaptcha&recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField + '&_wpnonce=' + ap_fileuploader.nonce + '&form_id=' + form_id,
async: false
}).responseText;
if (html == "success") {
//return true;
//Add the Action to the Form
//Indicate a Successful Captcha
//jQuery("#captcha-status").html("
Success! Thanks you may now proceed.
");
} else {
var error_message = jQuery('#' + form_id + ' .ap-captcha-error').attr('data-error-message');
if (error_message == '')
{
error_message = ap_captcha_error_message;
}
jQuery('#' + form_id + ' .ap-captcha-error').html(error_message);
Recaptcha.reload();
return false;
}
} else {
var captcha_val = jQuery('#g-recaptcha-response').val();
if (captcha_val != '') {
var response = jQuery.ajax({
type: 'POST',
url: ap_fileuploader.upload_url, // The file we're making the request to
data: 'captchaResponse=' + captcha_val + '&action=ap_validate_recaptcha&form_id=' + form_id + '&_wpnonce=' + ap_fileuploader.nonce,
async: false
}).responseText;
if (response != 'SPAM') {
return true;
} else {
var error_message = jQuery('#' + form_id + ' .ap-captcha-error').attr('data-error-message');
if (error_message == '')
{
error_message = ap_captcha_error_message;
}
jQuery('#' + form_id + ' .ap-captcha-error').html(error_message);
return false;
}
} else {
var error_message = jQuery('#' + form_id + ' .ap-captcha-error').attr('data-error-message');
if (error_message == '')
{
error_message = ap_captcha_error_message;
}
jQuery('#' + form_id + ' .ap-captcha-error').html(error_message);
return false;
}
}
} else
{
return true;
}
}
function validateEmail($email) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (!emailReg.test($email)) {
return false;
} else {
return true;
}
}
(function ($) {
$(function () {
//All js related for frontend
//Checking required fields
$('.ap-pro-front-form .ap-pro-submit-btn').click(function () {
var error_flag = 0;
var id = $(this).closest('.ap-pro-front-form').attr('id');
if ($('#' + id + ' .ap-form-wp-editor').length > 0)
{
tinyMCE.triggerSave();
if ($('#' + id + ' .ap-character-limit-flag').length > 0 && $('#' + id + ' .ap-character-limit-flag').val() == 1) {
error_flag = 1;
}
}
if ($('#' + id + ' .ap-form-content-editor').length > 0)
{
if ($.trim($('#' + id + ' .ap-form-content-editor').val()) == '' && $('#' + id + ' .ap-form-content-error').attr('data-required') == 'required')
{
error_flag = 1;
var error_msg = $('#' + id + ' .ap-form-content-error').attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$('#' + id + ' .ap-form-content-error').html(error_msg);
}
}
$('#' + id + ' input').each(function () {
if ($(this).hasClass('ap-required-field') && $.trim($(this).val()) == '')
{
error_flag = 1;
var error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html(error_msg);
}
if ($(this).hasClass('ap-email-field') && $.trim($(this).val() != ''))
{
if (!validateEmail($(this).val()))
{
error_flag = 1;
var error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html(error_msg);
}
}
if ($(this).attr('name') == 'ap_form_post_image' && $(this).val() != '') {
var file = $(this).val();
var file_array = file.split('\\');
var filename = file_array.pop();
var filename_array = filename.split('.');
var extension = filename_array.pop();
if (!(extension == 'jpg' || extension == 'jpeg' || extension == 'png' || extension == 'gif')) {
error_flag = 1;
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('Unsupported filetype');
}
}
});
$('#' + id + ' textarea.ap-pro-textarea').each(function () {
if ($(this).hasClass('ap-required-field') && $.trim($(this).val()) == '')
{
error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html(error_msg);
}
});
$('#' + id + ' select').each(function () {
if ($(this).hasClass('ap-required-field') && $.trim($(this).val()) == '')
{
error_flag = 1;
error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html(error_msg);
}
});
$('#' + id + ' .ap-radio-wrap').each(function () {
if ($(this).hasClass('ap-required-field') && $(this).find('input[type="radio"]:checked').length == 0)
{
error_flag = 1;
error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html(error_msg);
}
});
$('#' + id + ' .ap-checkbox-wrap').each(function () {
if ($(this).hasClass('ap-required-field') && $(this).find('input[type="checkbox"]:checked').length == 0)
{
error_flag = 1;
error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html(error_msg);
}
});
if ($('#' + id + ' .ap-agreement-checkbox').length > 0 && !$('#' + id + ' .ap-agreement-checkbox').is(":checked"))
{
error_flag = 1;
var error_msg = $('#' + id + ' .ap-agreement-checkbox').attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$('#' + id + ' .ap-agreement-error').html(error_msg);
}
if (error_flag == 1)
{
return false;
} else
{
return true;
}
});
$('.ap-pro-front-form input[type="text"]').keyup(function () {
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('');
});
$('.ap-pro-front-form textarea.ap-pro-textarea').keyup(function () {
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('');
});
$('.ap-form-content-editor').keyup(function () {
$('.ap-form-content-error').html('');
});
$('.ap-pro-front-form select,.ap-pro-front-form input[type="checkbox"]').change(function () {
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('');
});
$('.ap-form-content-editor').change(function () {
$('.ap-form-content-error').html('');
});
$('.ap-pro-datepicker').datepicker();
$('.ap-pro-datepicker').each(function () {
var date_format = $(this).data('date-format');
date_format = (date_format) ? date_format : 'yy-mm-dd';
$(this).datepicker("option", "dateFormat", date_format);
});
$('.ap-agreement-checkbox').click(function () {
if ($(this).is(':checked'))
{
$(this).closest('.ap-form-agreement-wrap').find('.ap-agreement-error').html('');
} else
{
var error_msg = $(this).attr('data-required-msg');
if (error_msg == '')
{
error_msg = ap_form_required_message;
}
$(this).closest('.ap-form-agreement-wrap').find('.ap-agreement-error').html(error_msg);
}
});
/*----------File Uploader-----------------*/
var uploader_counter = 0;
var uploader = {};
$('.ap-file-uploader').each(function () {
uploader_counter++;
var attr_element_id = $(this).attr('id');
var arr_element_id = attr_element_id.split('-');
var element_id = arr_element_id[3];
var extensions = $(this).attr('data-extensions');
var extensions_array = extensions.split('|');
var size = $(this).attr('data-size');
var multiple_upload = $(this).attr('data-multiple');
var limit_flag = 0;
var upload_limit = $(this).attr('data-upload-limit');
var selector = $(this);
var uploader_label = $(this).data('uploader-label');
var upload_limit_message = $(this).data('upload-limit-message');
var media_attachment = $(this).data('media-attachment');
uploader['uploader' + uploader_counter] = new qq.FileUploader({
element: document.getElementById('ap-file-uploader-' + uploader_counter),
// path to server-side upload script
// action: '/server/upload'
action: ap_fileuploader.upload_url,
params: {
action: 'ap_file_upload_action',
file_uploader_nonce: ap_fileuploader.nonce,
allowedExtensions: extensions_array,
sizeLimit: size,
element_id: element_id
},
allowedExtensions: extensions_array,
sizeLimit: size, // 100mb
minSizeLimit: 500,
uploadButtonText: uploader_label,
onSubmit: function (id, fileName) {
if (multiple_upload == true && upload_limit != -1) {
var limit_counter = selector.parent().find('.ap-pro-upload-counter').val();
limit_counter++;
selector.parent().find('.ap-pro-upload-counter').val(limit_counter);
//limit_counter = $('#ap-pro-file-preview'+id+' .ap-pro-prev-holder').length;
//alert(limit_counter);
if (limit_counter > upload_limit) {
if (limit_flag == 0) {
upload_limit_message = (upload_limit_message != '') ? upload_limit_message : 'Maximum number of files allowed is ' + upload_limit;
selector.parent().find('.ap-upload-limit-error').html(upload_limit_message);
//console.log(id);
//alert('Maximum number of files allowed is '+upload_limit);
limit_flag = 1;
}
selector.parent().find('.ap-pro-upload-counter').val(upload_limit);
return false;
}
}
},
onProgress: function (id, fileName, loaded, total) {
},
onComplete: function (id, fileName, responseJSON) {
//alert(id);
//console.log(responseJSON);
if (responseJSON.success)
{
//tinyMCE.triggerSave();
$('#ap-pro-file-url-' + element_id).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('');
var extension_array = fileName.split('.');
var extension = extension_array.pop();
if (extension == 'jpg' || extension == 'jpeg' || extension == 'png' || extension == 'gif' || extension == 'JPG' || extension == 'JPEG' || extension == 'PNG' || extension == 'GIF') {
var preview_html = '
' + fileName + 'x
';
} else {
var preview_html = '
' + fileName + 'x
';
}
if (multiple_upload)
{
var url = responseJSON.url;
var previous_url = $('#ap-pro-file-url-' + element_id).val();
if (previous_url == '')
{
$('#ap-pro-file-url-' + element_id).val(url);
} else
{
$('#ap-pro-file-url-' + element_id).val(previous_url + ',' + url);
}
$('#ap-pro-file-preview' + element_id).append(preview_html);
} else
{
$('#ap-pro-file-url-' + element_id).val(responseJSON.url);
$('#ap-pro-file-preview' + element_id).html(preview_html);
}
if (media_attachment == 1) {
var attachment_ids = selector.closest('form').find('.ap-attachment-ids').val();
if (attachment_ids != '') {
var attachment_ids_array = attachment_ids.split(',');
attachment_ids_array.push(responseJSON.attachment_id);
var attachment_ids = attachment_ids_array.join();
selector.closest('form').find('.ap-attachment-ids').val(attachment_ids);
} else {
selector.closest('form').find('.ap-attachment-ids').val(responseJSON.attachment_id);
}
}
}
},
onCancel: function (id, fileName) {
},
onError: function (id, fileName, xhr) {
},
messages: {
typeError: " {file} has invalid extension. Only {extensions} are allowed.",
sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
emptyError: "{file} is empty, please select files again without it.",
onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
},
showMessage: function (message) {
alert(message);
},
multiple: multiple_upload
});
});
if ($('.ap-content-file-uploader').length > 0)
{
$('.ap-content-file-uploader').each(function () {
var id = $(this).attr('id');
var link_source_url = $(this).data('link-source-url');
var lightbox_rel_attr = $(this).data('lightbox-rel-attr');
var uploadSizeLimit = $(this).attr('data-upload-size');
var content_image_uploader = new qq.FileUploader({
element: document.getElementById(id),
// path to server-side upload script
// action: '/server/upload'
action: ap_fileuploader.upload_url,
params: {
action: 'ap_file_upload_action',
file_uploader_nonce: ap_fileuploader.nonce,
allowedExtensions: ['jpg', 'png', 'gif', 'jpeg'],
sizeLimit: uploadSizeLimit,
},
allowedExtensions: ['jpg', 'png', 'gif', 'jpeg'],
sizeLimit: uploadSizeLimit, // 100mb
minSizeLimit: 500,
onSubmit: function (id, fileName) {
},
onProgress: function (id, fileName, loaded, total) {
},
onComplete: function (id, fileName, responseJSON) {
//console.log(responseJSON);
if (responseJSON.success)
{
tinyMCE.triggerSave();
if (link_source_url == 1) {
if (lightbox_rel_attr == 1) {
var insert_content = '';
} else {
var insert_content = '';
}
} else {
var insert_content = '';
}
tinyMCE.activeEditor.execCommand('mceInsertContent', false, insert_content);
$('#ap-content-file-uploader .qq-upload-list').html('');
}
},
onCancel: function (id, fileName) {
},
onError: function (id, fileName, xhr) {
},
messages: {
typeError: " {file} has invalid extension. Only {extensions} are allowed.",
sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
emptyError: "{file} is empty, please select files again without it.",
onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
},
showMessage: function (message) {
alert(message);
},
multiple: false
});
});
}
/*----------File Uploader-----------------*/
// tinyMCE.execCommand('mceInsertContent', false, "some text");
// tinyMCE.triggerSave();
/**
* File Delete Action
*/
$('body').on('click', '.ap-pro-preview-remove', function () {
var selector = $(this);
var path = $(this).data('path');
var ajax_url = ap_fileuploader.upload_url;
var url = $(this).data('url');
var id = $(this).data('id');
var attachment_id = $(this).data('attachment-id');
attachment_id = $.trim(attachment_id);
$.ajax({
url: ajax_url,
data: 'action=ap_file_delete_action&path=' + path + '&_wpnonce=' + ap_fileuploader.nonce + '&attachment_id=' + attachment_id,
type: 'post',
success: function (res) {
if (res == 'success') {
var attachment_ids = selector.closest('form').find('.ap-attachment-ids').val();
attachment_ids = $.trim(attachment_ids);
var attachment_ids_array = attachment_ids.split(',');
var attachment_index = attachment_ids_array.indexOf(attachment_id);
if (attachment_index != -1) {
attachment_ids_array.splice(attachment_index, 1);
var attachment_ids = attachment_ids_array.join();
selector.closest('form').find('.ap-attachment-ids').val(attachment_ids);
}
var prev_url = $('#ap-pro-file-url-' + id).val();
//alert(prev_url);
var new_url = prev_url.replace(url, '');
new_url = new_url.replace(',,', ',');
$('#ap-pro-file-url-' + id).val(new_url);
var limit_counter = $('#ap-pro-upload-counter-' + id).val();
//console.log(limit_counter);
limit_counter--;
//selector.closest('.ap-pro-form-field').find('.ap-upload-limit-error').html('');
$('#ap-pro-upload-counter-' + id).val(limit_counter);
selector.parent().fadeOut('1500', function () {
selector.parent().remove();
});
}
}
});
});
/** Limit Characters */
if ($('.ap-pro-character-limit').length > 0) {
var editor_char_limit = $('.ap-pro-character-limit').val();
// jQuery ready fires too early, use window.onload instead
window.onload = function () {
var char_limit_message = $('.ap-pro-character-limit-message').val();
jQuery('.mce-statusbar').append('' + char_limit_message + '');
tinyMCE.activeEditor.onKeyUp.add(function () {
$('.ap-form-content-error').html('');
// Strip HTML tags, WordPress shortcodes and white space
editor_content = this.getContent().replace(/(<[a-zA-Z\/][^<>]*>|\[([^\]]+)\])|(\s+)/ig, '');
//console.log(editor_content.length);
if (editor_content.length > editor_char_limit) {
jQuery('.mce-statusbar').addClass('toomanychars');
$('.ap-character-limit-flag').val(1);
//error_flag = 1;
} else {
jQuery('.mce-statusbar').removeClass('toomanychars');
$('.ap-character-limit-flag').val(0);
//error_flag = 0;
}
});
}
}
$('input[name="ap_form_post_image"]').change(function () {
var file = $(this).val();
var file_array = file.split('\\');
var filename = file_array.pop();
var filename_array = filename.split('.');
var extension = filename_array.pop();
if (!(extension == 'jpg' || extension == 'jpeg' || extension == 'png' || extension == 'gif')) {
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('Unsupported filetype');
} else {
$(this).closest('.ap-pro-form-field-wrapper').find('.ap-form-error').html('');
}
});
}); //document.ready close
}(jQuery));
// source --> https://givegetgigs.com/wp-content/plugins/rewardsystem/admin/js/footable.js?ver=85ae72a5a07798878e5fcbf818ef0f2a
/*!
* FooTable - Awesome Responsive Tables
* Version : 2.0.1.4
* http://fooplugins.com/plugins/footable-jquery/
*
* Requires jQuery - http://jquery.com/
*
* Copyright 2014 Steven Usher & Brad Vincent
* Released under the MIT license
* You are free to use FooTable in commercial projects as long as this copyright header is left intact.
*
* Date: 16 Feb 2014
*/
(function ($, w, undefined) {
w.footable = {
options: {
delay: 100, // The number of millseconds to wait before triggering the react event
breakpoints: { // The different screen resolution breakpoints
phone: 480,
tablet: 1024
},
parsers: { // The default parser to parse the value out of a cell (values are used in building up row detail)
alpha: function (cell) {
return $(cell).data('value') || $.trim($(cell).text());
},
numeric: function (cell) {
var val = $(cell).data('value') || $(cell).text().replace(/[^0-9.\-]/g, '');
val = parseFloat(val);
if (isNaN(val)) val = 0;
return val;
}
},
addRowToggle: true,
calculateWidthOverride: null,
toggleSelector: ' > tbody > tr:not(.footable-row-detail)', //the selector to show/hide the detail row
columnDataSelector: '> thead > tr:last-child > th, > thead > tr:last-child > td', //the selector used to find the column data in the thead
detailSeparator: ':', //the separator character used when building up the detail row
toggleHTMLElement: '', // override this if you want to insert a click target rather than use a background image.
createGroupedDetail: function (data) {
var groups = { '_none': { 'name': null, 'data': [] } };
for (var i = 0; i < data.length; i++) {
var groupid = data[i].group;
if (groupid !== null) {
if (!(groupid in groups))
groups[groupid] = { 'name': data[i].groupName || data[i].group, 'data': [] };
groups[groupid].data.push(data[i]);
} else {
groups._none.data.push(data[i]);
}
}
return groups;
},
createDetail: function (element, data, createGroupedDetail, separatorChar, classes) {
/// This function is used by FooTable to generate the detail view seen when expanding a collapsed row.
/// This is the div that contains all the detail row information, anything could be added to it.
///
/// This is an array of objects containing the cell information for the current row.
/// These objects look like the below:
/// obj = {
/// 'name': String, // The name of the column
/// 'value': Object, // The value parsed from the cell using the parsers. This could be a string, a number or whatever the parser outputs.
/// 'display': String, // This is the actual HTML from the cell, so if you have images etc you want moved this is the one to use and is the default value used.
/// 'group': String, // This is the identifier used in the data-group attribute of the column.
/// 'groupName': String // This is the actual name of the group the column belongs to.
/// }
///
/// The grouping function to group the data
/// The separator charactor used
/// The array of class names used to build up the detail row
var groups = createGroupedDetail(data);
for (var group in groups) {
if (groups[group].data.length === 0) continue;
if (group !== '_none') element.append('
' + groups[group].name + '
');
for (var j = 0; j < groups[group].data.length; j++) {
var separator = (groups[group].data[j].name) ? separatorChar : '';
element.append('
' + groups[group].data[j].name + separator + '
' + groups[group].data[j].display + '
');
}
}
},
classes: {
main: 'footable',
loading: 'footable-loading',
loaded: 'footable-loaded',
toggle: 'footable-toggle',
disabled: 'footable-disabled',
detail: 'footable-row-detail',
detailCell: 'footable-row-detail-cell',
detailInner: 'footable-row-detail-inner',
detailInnerRow: 'footable-row-detail-row',
detailInnerGroup: 'footable-row-detail-group',
detailInnerName: 'footable-row-detail-name',
detailInnerValue: 'footable-row-detail-value',
detailShow: 'footable-detail-show'
},
triggers: {
initialize: 'footable_initialize', //trigger this event to force FooTable to reinitialize
resize: 'footable_resize', //trigger this event to force FooTable to resize
redraw: 'footable_redraw', //trigger this event to force FooTable to redraw
toggleRow: 'footable_toggle_row', //trigger this event to force FooTable to toggle a row
expandFirstRow: 'footable_expand_first_row', //trigger this event to force FooTable to expand the first row
expandAll: 'footable_expand_all', //trigger this event to force FooTable to expand all rows
collapseAll: 'footable_collapse_all' //trigger this event to force FooTable to collapse all rows
},
events: {
alreadyInitialized: 'footable_already_initialized', //fires when the FooTable has already been initialized
initializing: 'footable_initializing', //fires before FooTable starts initializing
initialized: 'footable_initialized', //fires after FooTable has finished initializing
resizing: 'footable_resizing', //fires before FooTable resizes
resized: 'footable_resized', //fires after FooTable has resized
redrawn: 'footable_redrawn', //fires after FooTable has redrawn
breakpoint: 'footable_breakpoint', //fires inside the resize function, when a breakpoint is hit
columnData: 'footable_column_data', //fires when setting up column data. Plugins should use this event to capture their own info about a column
rowDetailUpdating: 'footable_row_detail_updating', //fires before a detail row is updated
rowDetailUpdated: 'footable_row_detail_updated', //fires when a detail row is being updated
rowCollapsed: 'footable_row_collapsed', //fires when a row is collapsed
rowExpanded: 'footable_row_expanded', //fires when a row is expanded
rowRemoved: 'footable_row_removed', //fires when a row is removed
reset: 'footable_reset' //fires when FooTable is reset
},
debug: false, // Whether or not to log information to the console.
log: null
},
version: {
major: 0, minor: 5,
toString: function () {
return w.footable.version.major + '.' + w.footable.version.minor;
},
parse: function (str) {
version = /(\d+)\.?(\d+)?\.?(\d+)?/.exec(str);
return {
major: parseInt(version[1], 10) || 0,
minor: parseInt(version[2], 10) || 0,
patch: parseInt(version[3], 10) || 0
};
}
},
plugins: {
_validate: function (plugin) {
///Simple validation of the to make sure any members called by FooTable actually exist.
///The object defining the plugin, this should implement a string property called "name" and a function called "init".
if (!$.isFunction(plugin)) {
if (w.footable.options.debug === true) console.error('Validation failed, expected type "function", received type "{0}".', typeof plugin);
return false;
}
var p = new plugin();
if (typeof p['name'] !== 'string') {
if (w.footable.options.debug === true) console.error('Validation failed, plugin does not implement a string property called "name".', p);
return false;
}
if (!$.isFunction(p['init'])) {
if (w.footable.options.debug === true) console.error('Validation failed, plugin "' + p['name'] + '" does not implement a function called "init".', p);
return false;
}
if (w.footable.options.debug === true) console.log('Validation succeeded for plugin "' + p['name'] + '".', p);
return true;
},
registered: [], // An array containing all registered plugins.
register: function (plugin, options) {
///Registers a and its default with FooTable.
///The plugin that should implement a string property called "name" and a function called "init".
///The default options to merge with the FooTable's base options.
if (w.footable.plugins._validate(plugin)) {
w.footable.plugins.registered.push(plugin);
if (typeof options === 'object') $.extend(true, w.footable.options, options);
}
},
load: function(instance){
var loaded = [], registered, i;
for(i = 0; i < w.footable.plugins.registered.length; i++){
try {
registered = w.footable.plugins.registered[i];
loaded.push(new registered(instance));
} catch (err) {
if (w.footable.options.debug === true) console.error(err);
}
}
return loaded;
},
init: function (instance) {
///Loops through all registered plugins and calls the "init" method supplying the current of the FooTable as the first parameter.
///The current instance of the FooTable that the plugin is being initialized for.
for (var i = 0; i < instance.plugins.length; i++) {
try {
instance.plugins[i]['init'](instance);
} catch (err) {
if (w.footable.options.debug === true) console.error(err);
}
}
}
}
};
var instanceCount = 0;
$.fn.footable = function (options) {
///The main constructor call to initialize the plugin using the supplied .
///
///A JSON object containing user defined options for the plugin to use. Any options not supplied will have a default value assigned.
///Check the documentation or the default options object above for more information on available options.
///
options = options || {};
var o = $.extend(true, {}, w.footable.options, options); //merge user and default options
return this.each(function () {
instanceCount++;
var footable = new Footable(this, o, instanceCount);
$(this).data('footable', footable);
});
};
//helper for using timeouts
function Timer() {
///Simple timer object created around a timeout.
var t = this;
t.id = null;
t.busy = false;
t.start = function (code, milliseconds) {
///Starts the timer and waits the specified amount of before executing the supplied .
///The code to execute once the timer runs out.
///The time in milliseconds to wait before executing the supplied .
if (t.busy) {
return;
}
t.stop();
t.id = setTimeout(function () {
code();
t.id = null;
t.busy = false;
}, milliseconds);
t.busy = true;
};
t.stop = function () {
///Stops the timer if its runnning and resets it back to its starting state.
if (t.id !== null) {
clearTimeout(t.id);
t.id = null;
t.busy = false;
}
};
}
function Footable(t, o, id) {
///Inits a new instance of the plugin.
///The main table element to apply this plugin to.
///The options supplied to the plugin. Check the defaults object to see all available options.
///The id to assign to this instance of the plugin.
var ft = this;
ft.id = id;
ft.table = t;
ft.options = o;
ft.breakpoints = [];
ft.breakpointNames = '';
ft.columns = {};
ft.plugins = w.footable.plugins.load(ft);
var opt = ft.options,
cls = opt.classes,
evt = opt.events,
trg = opt.triggers,
indexOffset = 0;
// This object simply houses all the timers used in the FooTable.
ft.timers = {
resize: new Timer(),
register: function (name) {
ft.timers[name] = new Timer();
return ft.timers[name];
}
};
ft.init = function () {
var $window = $(w), $table = $(ft.table);
w.footable.plugins.init(ft);
if ($table.hasClass(cls.loaded)) {
//already loaded FooTable for the table, so don't init again
ft.raise(evt.alreadyInitialized);
return;
}
//raise the initializing event
ft.raise(evt.initializing);
$table.addClass(cls.loading);
// Get the column data once for the life time of the plugin
$table.find(opt.columnDataSelector).each(function () {
var data = ft.getColumnData(this);
ft.columns[data.index] = data;
});
// Create a nice friendly array to work with out of the breakpoints object.
for (var name in opt.breakpoints) {
ft.breakpoints.push({ 'name': name, 'width': opt.breakpoints[name] });
ft.breakpointNames += (name + ' ');
}
// Sort the breakpoints so the smallest is checked first
ft.breakpoints.sort(function (a, b) {
return a['width'] - b['width'];
});
$table
.unbind(trg.initialize)
//bind to FooTable initialize trigger
.bind(trg.initialize, function () {
//remove previous "state" (to "force" a resize)
$table.removeData('footable_info');
$table.data('breakpoint', '');
//trigger the FooTable resize
$table.trigger(trg.resize);
//remove the loading class
$table.removeClass(cls.loading);
//add the FooTable and loaded class
$table.addClass(cls.loaded).addClass(cls.main);
//raise the initialized event
ft.raise(evt.initialized);
})
.unbind(trg.redraw)
//bind to FooTable redraw trigger
.bind(trg.redraw, function () {
ft.redraw();
})
.unbind(trg.resize)
//bind to FooTable resize trigger
.bind(trg.resize, function () {
ft.resize();
})
.unbind(trg.expandFirstRow)
//bind to FooTable expandFirstRow trigger
.bind(trg.expandFirstRow, function () {
$table.find(opt.toggleSelector).first().not('.' + cls.detailShow).trigger(trg.toggleRow);
})
.unbind(trg.expandAll)
//bind to FooTable expandFirstRow trigger
.bind(trg.expandAll, function () {
$table.find(opt.toggleSelector).not('.' + cls.detailShow).trigger(trg.toggleRow);
})
.unbind(trg.collapseAll)
//bind to FooTable expandFirstRow trigger
.bind(trg.collapseAll, function () {
$table.find('.' + cls.detailShow).trigger(trg.toggleRow);
});
//trigger a FooTable initialize
$table.trigger(trg.initialize);
//bind to window resize
$window
.bind('resize.footable', function () {
ft.timers.resize.stop();
ft.timers.resize.start(function () {
ft.raise(trg.resize);
}, opt.delay);
});
};
ft.addRowToggle = function () {
if (!opt.addRowToggle) return;
var $table = $(ft.table),
hasToggleColumn = false;
//first remove all toggle spans
$table.find('span.' + cls.toggle).remove();
for (var c in ft.columns) {
var col = ft.columns[c];
if (col.toggle) {
hasToggleColumn = true;
var selector = '> tbody > tr:not(.' + cls.detail + ',.' + cls.disabled + ') > td:nth-child(' + (parseInt(col.index, 10) + 1) + ')';
$table.find(selector).not('.' + cls.detailCell).prepend($(opt.toggleHTMLElement).addClass(cls.toggle));
return;
}
}
//check if we have an toggle column. If not then add it to the first column just to be safe
if (!hasToggleColumn) {
$table
.find('> tbody > tr:not(.' + cls.detail + ',.' + cls.disabled + ') > td:first-child')
.not('.' + cls.detailCell)
.prepend($(opt.toggleHTMLElement).addClass(cls.toggle));
}
};
ft.setColumnClasses = function () {
$table = $(ft.table);
for (var c in ft.columns) {
var col = ft.columns[c];
if (col.className !== null) {
var selector = '', first = true;
$.each(col.matches, function (m, match) { //support for colspans
if (!first) selector += ', ';
selector += '> tbody > tr:not(.' + cls.detail + ') > td:nth-child(' + (parseInt(match, 10) + 1) + ')';
first = false;
});
//add the className to the cells specified by data-class="blah"
$table.find(selector).not('.' + cls.detailCell).addClass(col.className);
}
}
};
//moved this out into it's own function so that it can be called from other add-ons
ft.bindToggleSelectors = function () {
var $table = $(ft.table);
if (!ft.hasAnyBreakpointColumn()) return;
$table.find(opt.toggleSelector).unbind(trg.toggleRow).bind(trg.toggleRow, function (e) {
var $row = $(this).is('tr') ? $(this) : $(this).parents('tr:first');
ft.toggleDetail($row);
});
$table.find(opt.toggleSelector).unbind('click.footable').bind('click.footable', function (e) {
if ($table.is('.breakpoint') && $(e.target).is('td,.'+ cls.toggle)) {
$(this).trigger(trg.toggleRow);
}
});
};
ft.parse = function (cell, column) {
var parser = opt.parsers[column.type] || opt.parsers.alpha;
return parser(cell);
};
ft.getColumnData = function (th) {
var $th = $(th), hide = $th.data('hide'), index = $th.index();
hide = hide || '';
hide = jQuery.map(hide.split(','), function (a) {
return jQuery.trim(a);
});
var data = {
'index': index,
'hide': { },
'type': $th.data('type') || 'alpha',
'name': $th.data('name') || $.trim($th.text()),
'ignore': $th.data('ignore') || false,
'toggle': $th.data('toggle') || false,
'className': $th.data('class') || null,
'matches': [],
'names': { },
'group': $th.data('group') || null,
'groupName': null
};
if (data.group !== null) {
var $group = $(ft.table).find('> thead > tr.footable-group-row > th[data-group="' + data.group + '"], > thead > tr.footable-group-row > td[data-group="' + data.group + '"]').first();
data.groupName = ft.parse($group, { 'type': 'alpha' });
}
var pcolspan = parseInt($th.prev().attr('colspan') || 0, 10);
indexOffset += pcolspan > 1 ? pcolspan - 1 : 0;
var colspan = parseInt($th.attr('colspan') || 0, 10), curindex = data.index + indexOffset;
if (colspan > 1) {
var names = $th.data('names');
names = names || '';
names = names.split(',');
for (var i = 0; i < colspan; i++) {
data.matches.push(i + curindex);
if (i < names.length) data.names[i + curindex] = names[i];
}
} else {
data.matches.push(curindex);
}
data.hide['default'] = ($th.data('hide') === "all") || ($.inArray('default', hide) >= 0);
var hasBreakpoint = false;
for (var name in opt.breakpoints) {
data.hide[name] = ($th.data('hide') === "all") || ($.inArray(name, hide) >= 0);
hasBreakpoint = hasBreakpoint || data.hide[name];
}
data.hasBreakpoint = hasBreakpoint;
var e = ft.raise(evt.columnData, { 'column': { 'data': data, 'th': th } });
return e.column.data;
};
ft.getViewportWidth = function () {
return window.innerWidth || (document.body ? document.body.offsetWidth : 0);
};
ft.calculateWidth = function ($table, info) {
if (jQuery.isFunction(opt.calculateWidthOverride)) {
return opt.calculateWidthOverride($table, info);
}
if (info.viewportWidth < info.width) info.width = info.viewportWidth;
if (info.parentWidth < info.width) info.width = info.parentWidth;
return info;
};
ft.hasBreakpointColumn = function (breakpoint) {
for (var c in ft.columns) {
if (ft.columns[c].hide[breakpoint]) {
if (ft.columns[c].ignore) {
continue;
}
return true;
}
}
return false;
};
ft.hasAnyBreakpointColumn = function () {
for (var c in ft.columns) {
if (ft.columns[c].hasBreakpoint) {
return true;
}
}
return false;
};
ft.resize = function () {
var $table = $(ft.table);
if (!$table.is(':visible')) {
return;
} //we only care about FooTables that are visible
if (!ft.hasAnyBreakpointColumn()) {
return;
} //we only care about FooTables that have breakpoints
var info = {
'width': $table.width(), //the table width
'viewportWidth': ft.getViewportWidth(), //the width of the viewport
'parentWidth': $table.parent().width() //the width of the parent
};
info = ft.calculateWidth($table, info);
var pinfo = $table.data('footable_info');
$table.data('footable_info', info);
ft.raise(evt.resizing, { 'old': pinfo, 'info': info });
// This (if) statement is here purely to make sure events aren't raised twice as mobile safari seems to do
if (!pinfo || (pinfo && pinfo.width && pinfo.width !== info.width)) {
var current = null, breakpoint;
for (var i = 0; i < ft.breakpoints.length; i++) {
breakpoint = ft.breakpoints[i];
if (breakpoint && breakpoint.width && info.width <= breakpoint.width) {
current = breakpoint;
break;
}
}
var breakpointName = (current === null ? 'default' : current['name']),
hasBreakpointFired = ft.hasBreakpointColumn(breakpointName),
previousBreakpoint = $table.data('breakpoint');
$table
.data('breakpoint', breakpointName)
.removeClass('default breakpoint').removeClass(ft.breakpointNames)
.addClass(breakpointName + (hasBreakpointFired ? ' breakpoint' : ''));
//only do something if the breakpoint has changed
if (breakpointName !== previousBreakpoint) {
//trigger a redraw
$table.trigger(trg.redraw);
//raise a breakpoint event
ft.raise(evt.breakpoint, { 'breakpoint': breakpointName, 'info': info });
}
}
ft.raise(evt.resized, { 'old': pinfo, 'info': info });
};
ft.redraw = function () {
//add the toggler to each row
ft.addRowToggle();
//bind the toggle selector click events
ft.bindToggleSelectors();
//set any cell classes defined for the columns
ft.setColumnClasses();
var $table = $(ft.table),
breakpointName = $table.data('breakpoint'),
hasBreakpointFired = ft.hasBreakpointColumn(breakpointName);
$table
.find('> tbody > tr:not(.' + cls.detail + ')').data('detail_created', false).end()
.find('> thead > tr:last-child > th')
.each(function () {
var data = ft.columns[$(this).index()], selector = '', first = true;
$.each(data.matches, function (m, match) {
if (!first) {
selector += ', ';
}
var count = match + 1;
selector += '> tbody > tr:not(.' + cls.detail + ') > td:nth-child(' + count + ')';
selector += ', > tfoot > tr:not(.' + cls.detail + ') > td:nth-child(' + count + ')';
selector += ', > colgroup > col:nth-child(' + count + ')';
first = false;
});
selector += ', > thead > tr[data-group-row="true"] > th[data-group="' + data.group + '"]';
var $column = $table.find(selector).add(this);
if (breakpointName !== '') {
if (data.hide[breakpointName] === false) $column.addClass('footable-visible').show();
else $column.removeClass('footable-visible').hide();
}
if ($table.find('> thead > tr.footable-group-row').length === 1) {
var $groupcols = $table.find('> thead > tr:last-child > th[data-group="' + data.group + '"]:visible, > thead > tr:last-child > th[data-group="' + data.group + '"]:visible'),
$group = $table.find('> thead > tr.footable-group-row > th[data-group="' + data.group + '"], > thead > tr.footable-group-row > td[data-group="' + data.group + '"]'),
groupspan = 0;
$.each($groupcols, function () {
groupspan += parseInt($(this).attr('colspan') || 1, 10);
});
if (groupspan > 0) $group.attr('colspan', groupspan).show();
else $group.hide();
}
})
.end()
.find('> tbody > tr.' + cls.detailShow).each(function () {
ft.createOrUpdateDetailRow(this);
});
$table.find('> tbody > tr.' + cls.detailShow + ':visible').each(function () {
var $next = $(this).next();
if ($next.hasClass(cls.detail)) {
if (!hasBreakpointFired) $next.hide();
else $next.show();
}
});
// adding .footable-first-column and .footable-last-column to the first and last th and td of each row in order to allow
// for styling if the first or last column is hidden (which won't work using :first-child or :last-child)
$table.find('> thead > tr > th.footable-last-column, > tbody > tr > td.footable-last-column').removeClass('footable-last-column');
$table.find('> thead > tr > th.footable-first-column, > tbody > tr > td.footable-first-column').removeClass('footable-first-column');
$table.find('> thead > tr, > tbody > tr')
.find('> th.footable-visible:last, > td.footable-visible:last')
.addClass('footable-last-column')
.end()
.find('> th.footable-visible:first, > td.footable-visible:first')
.addClass('footable-first-column');
ft.raise(evt.redrawn);
};
ft.toggleDetail = function (row) {
var $row = (row.jquery) ? row : $(row),
$next = $row.next();
//check if the row is already expanded
if ($row.hasClass(cls.detailShow)) {
$row.removeClass(cls.detailShow);
//only hide the next row if it's a detail row
if ($next.hasClass(cls.detail)) $next.hide();
ft.raise(evt.rowCollapsed, { 'row': $row[0] });
} else {
ft.createOrUpdateDetailRow($row[0]);
$row.addClass(cls.detailShow)
.next().show();
ft.raise(evt.rowExpanded, { 'row': $row[0] });
}
};
ft.removeRow = function (row) {
var $row = (row.jquery) ? row : $(row);
if ($row.hasClass(cls.detail)) {
$row = $row.prev();
}
var $next = $row.next();
if ($row.data('detail_created') === true) {
//remove the detail row
$next.remove();
}
$row.remove();
//raise event
ft.raise(evt.rowRemoved);
};
ft.appendRow = function (row) {
var $row = (row.jquery) ? row : $(row);
$(ft.table).find('tbody').append($row);
//redraw the table
ft.redraw();
};
ft.getColumnFromTdIndex = function (index) {
/// Returns the correct column data for the supplied index taking into account colspans.
/// The index to retrieve the column data for.
/// A JSON object containing the column data for the supplied index.
var result = null;
for (var column in ft.columns) {
if ($.inArray(index, ft.columns[column].matches) >= 0) {
result = ft.columns[column];
break;
}
}
return result;
};
ft.createOrUpdateDetailRow = function (actualRow) {
var $row = $(actualRow), $next = $row.next(), $detail, values = [];
if ($row.data('detail_created') === true) return true;
if ($row.is(':hidden')) return false; //if the row is hidden for some reason (perhaps filtered) then get out of here
ft.raise(evt.rowDetailUpdating, { 'row': $row, 'detail': $next });
$row.find('> td:hidden').each(function () {
var index = $(this).index(), column = ft.getColumnFromTdIndex(index), name = column.name;
if (column.ignore === true) return true;
if (index in column.names) name = column.names[index];
values.push({ 'name': name, 'value': ft.parse(this, column), 'display': $.trim($(this).html()), 'group': column.group, 'groupName': column.groupName });
return true;
});
if (values.length === 0) return false; //return if we don't have any data to show
var colspan = $row.find('> td:visible').length;
var exists = $next.hasClass(cls.detail);
if (!exists) { // Create
$next = $('
');
$row.after($next);
}
$next.find('> td:first').attr('colspan', colspan);
$detail = $next.find('.' + cls.detailInner).empty();
opt.createDetail($detail, values, opt.createGroupedDetail, opt.detailSeparator, cls);
$row.data('detail_created', true);
ft.raise(evt.rowDetailUpdated, { 'row': $row, 'detail': $next });
return !exists;
};
ft.raise = function (eventName, args) {
if (ft.options.debug === true && $.isFunction(ft.options.log)) ft.options.log(eventName, 'event');
args = args || { };
var def = { 'ft': ft };
$.extend(true, def, args);
var e = $.Event(eventName, def);
if (!e.ft) {
$.extend(true, e, def);
} //pre jQuery 1.6 which did not allow data to be passed to event object constructor
$(ft.table).trigger(e);
return e;
};
//reset the state of FooTable
ft.reset = function() {
var $table = $(ft.table);
$table.removeData('footable_info')
.data('breakpoint', '')
.removeClass(cls.loading)
.removeClass(cls.loaded);
$table.find(opt.toggleSelector).unbind(trg.toggleRow).unbind('click.footable');
$table.find('> tbody > tr').removeClass(cls.detailShow);
$table.find('> tbody > tr.' + cls.detail).remove();
ft.raise(evt.reset);
};
ft.init();
return ft;
}
})(jQuery, window);
// source --> https://givegetgigs.com/wp-content/plugins/rewardsystem/admin/js/footable.sort.js?ver=85ae72a5a07798878e5fcbf818ef0f2a
(function ($, w, undefined) {
if (w.footable === undefined || w.footable === null)
throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.');
var defaults = {
sort: true,
sorters: {
alpha: function (a, b) {
if (typeof(a) === 'string') { a = a.toLowerCase(); }
if (typeof(b) === 'string') { b = b.toLowerCase(); }
if (a === b) return 0;
if (a < b) return -1;
return 1;
},
numeric: function (a, b) {
return a - b;
}
},
classes: {
sort: {
sortable: 'footable-sortable',
sorted: 'footable-sorted',
descending: 'footable-sorted-desc',
indicator: 'footable-sort-indicator'
}
},
events: {
sort: {
sorting: 'footable_sorting',
sorted: 'footable_sorted'
}
}
};
function Sort() {
var p = this;
p.name = 'Footable Sortable';
p.init = function (ft) {
p.footable = ft;
if (ft.options.sort === true) {
$(ft.table)
.unbind('.sorting')
.bind({
'footable_initialized.sorting': function (e) {
var $table = $(ft.table),
$tbody = $table.find('> tbody'),
cls = ft.options.classes.sort,
column, $th;
if ($table.data('sort') === false) return;
$table.find('> thead > tr:last-child > th, > thead > tr:last-child > td').each(function (ec) {
$th = $(this), column = ft.columns[$th.index()];
if (column.sort.ignore !== true && !$th.hasClass(cls.sortable)) {
$th.addClass(cls.sortable);
$('').addClass(cls.indicator).appendTo($th);
}
});
$table.find('> thead > tr:last-child > th.' + cls.sortable + ', > thead > tr:last-child > td.' + cls.sortable).unbind('click.footable').bind('click.footable', function (ec) {
ec.preventDefault();
$th = $(this);
var ascending = !$th.hasClass(cls.sorted);
p.doSort($th.index(), ascending);
return false;
});
var didSomeSorting = false;
for (var c in ft.columns) {
column = ft.columns[c];
if (column.sort.initial) {
var ascending = (column.sort.initial !== 'descending');
p.doSort(column.index, ascending);
break;
}
}
if (didSomeSorting) {
ft.bindToggleSelectors();
}
},
'footable_redrawn.sorting': function(e) {
var $table = $(ft.table),
cls = ft.options.classes.sort;
if ($table.data('sorted') >= 0) {
$table.find('> thead > tr:last-child > th').each(function(i){
var $th = $(this);
if ($th.hasClass(cls.sorted) || $th.hasClass(cls.descending)) {
p.doSort(i);
return;
}
});
}
},
'footable_column_data.sorting': function (e) {
var $th = $(e.column.th);
e.column.data.sort = e.column.data.sort || {};
e.column.data.sort.initial = $th.data('sort-initial') || false;
e.column.data.sort.ignore = $th.data('sort-ignore') || false;
e.column.data.sort.selector = $th.data('sort-selector') || null;
var match = $th.data('sort-match') || 0;
if (match >= e.column.data.matches.length) match = 0;
e.column.data.sort.match = e.column.data.matches[match];
}
})
//save the sort object onto the table so we can access it later
.data('footable-sort', p);
}
};
p.doSort = function(columnIndex, ascending) {
var ft = p.footable;
if ($(ft.table).data('sort') === false) return;
var $table = $(ft.table),
$tbody = $table.find('> tbody'),
column = ft.columns[columnIndex],
$th = $table.find('> thead > tr:last-child > th:eq(' + columnIndex + ')'),
cls = ft.options.classes.sort,
evt = ft.options.events.sort;
ascending = (ascending === undefined) ? $th.hasClass(cls.sorted) :
(ascending === 'toggle') ? !$th.hasClass(cls.sorted) : ascending;
if (column.sort.ignore === true) return true;
//raise a pre-sorting event so that we can cancel the sorting if needed
var event = ft.raise(evt.sorting, { column: column, direction: ascending ? 'ASC' : 'DESC' });
if (event && event.result === false) return;
$table.data('sorted', column.index);
$table.find('> thead > tr:last-child > th, > thead > tr:last-child > td').not($th).removeClass(cls.sorted + ' ' + cls.descending);
if (ascending === undefined) {
ascending = $th.hasClass(cls.sorted);
}
if (ascending) {
$th.removeClass(cls.descending).addClass(cls.sorted);
} else {
$th.removeClass(cls.sorted).addClass(cls.descending);
}
p.sort(ft, $tbody, column, ascending);
ft.bindToggleSelectors();
ft.raise(evt.sorted, { column: column, direction: ascending ? 'ASC' : 'DESC' });
};
p.rows = function (ft, tbody, column) {
var rows = [];
tbody.find('> tr').each(function () {
var $row = $(this), $next = null;
if ($row.hasClass(ft.options.classes.detail)) return true;
if ($row.next().hasClass(ft.options.classes.detail)) {
$next = $row.next().get(0);
}
var row = { 'row': $row, 'detail': $next };
if (column !== undefined) {
row.value = ft.parse(this.cells[column.sort.match], column);
}
rows.push(row);
return true;
}).detach();
return rows;
};
p.sort = function (ft, tbody, column, ascending) {
var rows = p.rows(ft, tbody, column);
var sorter = ft.options.sorters[column.type] || ft.options.sorters.alpha;
rows.sort(function (a, b) {
if (ascending) {
return sorter(a.value, b.value);
} else {
return sorter(b.value, a.value);
}
});
for (var j = 0; j < rows.length; j++) {
tbody.append(rows[j].row);
if (rows[j].detail !== null) {
tbody.append(rows[j].detail);
}
}
};
}
w.footable.plugins.register(Sort, defaults);
})(jQuery, window);
// source --> https://givegetgigs.com/wp-content/plugins/rewardsystem/admin/js/footable.paginate.js?ver=85ae72a5a07798878e5fcbf818ef0f2a
(function ($, w, undefined) {
if (w.footable === undefined || w.footable === null)
throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.');
var defaults = {
paginate: true,
pageSize: 10,
pageNavigation: '.pagination',
firstText: '«',
previousText: '‹',
nextText: '›',
lastText: '»',
limitNavigation: 0,
limitPreviousText: '...',
limitNextText: '...'
};
function pageInfo(ft) {
var $table = $(ft.table), data = $table.data();
this.pageNavigation = data.pageNavigation || ft.options.pageNavigation;
this.pageSize = data.pageSize || ft.options.pageSize;
this.firstText = data.firstText || ft.options.firstText;
this.previousText = data.previousText || ft.options.previousText;
this.nextText = data.nextText || ft.options.nextText;
this.lastText = data.lastText || ft.options.lastText;
this.limitNavigation = parseInt(data.limitNavigation || ft.options.limitNavigation || defaults.limitNavigation, 10);
this.limitPreviousText = data.limitPreviousText || ft.options.limitPreviousText;
this.limitNextText = data.limitNextText || ft.options.limitNextText;
this.limit = this.limitNavigation > 0;
this.currentPage = data.currentPage || 0;
this.pages = [];
this.control = false;
}
function Paginate() {
var p = this;
p.name = 'Footable Paginate';
p.init = function (ft) {
if (ft.options.paginate === true) {
if ($(ft.table).data('page') === false) return;
p.footable = ft;
$(ft.table)
.unbind('.paging')
.bind({
'footable_initialized.paging footable_row_removed.paging footable_redrawn.paging footable_sorted.paging footable_filtered.paging': function () {
p.setupPaging();
}
})
//save the filter object onto the table so we can access it later
.data('footable-paging', p);
}
};
p.setupPaging = function () {
var ft = p.footable,
$tbody = $(ft.table).find('> tbody');
ft.pageInfo = new pageInfo(ft);
p.createPages(ft, $tbody);
p.createNavigation(ft, $tbody);
p.fillPage(ft, $tbody, ft.pageInfo.currentPage);
};
p.createPages = function (ft, tbody) {
var pages = 1;
var info = ft.pageInfo;
var pageCount = pages * info.pageSize;
var page = [];
var lastPage = [];
info.pages = [];
var rows = tbody.find('> tr:not(.footable-filtered,.footable-row-detail)');
rows.each(function (i, row) {
page.push(row);
if (i === pageCount - 1) {
info.pages.push(page);
pages++;
pageCount = pages * info.pageSize;
page = [];
} else if (i >= rows.length - (rows.length % info.pageSize)) {
lastPage.push(row);
}
});
if (lastPage.length > 0) info.pages.push(lastPage);
if (info.currentPage >= info.pages.length) info.currentPage = info.pages.length - 1;
if (info.currentPage < 0) info.currentPage = 0;
if (info.pages.length === 1) {
//we only have a single page
$(ft.table).addClass('no-paging');
} else {
$(ft.table).removeClass('no-paging');
}
};
p.createNavigation = function (ft, tbody) {
var $nav = $(ft.table).find(ft.pageInfo.pageNavigation);
//if we cannot find the navigation control within the table, then try find it outside
if ($nav.length === 0) {
$nav = $(ft.pageInfo.pageNavigation);
//if the navigation control is inside another table, then get out
if ($nav.parents('table:first').length > 0 && $nav.parents('table:first') !== $(ft.table)) return;
//if we found more than one navigation control, write error to console
if ($nav.length > 1 && ft.options.debug === true) console.error('More than one pagination control was found!');
}
//if we still cannot find the control, then don't do anything
if ($nav.length === 0) return;
//if the nav is not a UL, then find or create a UL
if (!$nav.is('ul')) {
if ($nav.find('ul:first').length === 0) {
$nav.append('
');
}
$nav = $nav.find('ul');
}
$nav.find('li').remove();
var info = ft.pageInfo;
info.control = $nav;
if (info.pages.length > 0) {
$nav.append('
");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";r.pagingCount===1?r.directionNav.addClass(e).attr("tabindex","-1"):r.vars.animationLoop?r.directionNav.removeClass(e).removeAttr("tabindex"):r.animatingTo===0?r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):r.animatingTo===r.last?r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):r.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('
");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";r.pagingCount===1?r.directionNav.addClass(e).attr("tabindex","-1"):r.vars.animationLoop?r.directionNav.removeClass(e).removeAttr("tabindex"):r.animatingTo===0?r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):r.animatingTo===r.last?r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):r.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('
');if(r.controlsContainer){r.controlsContainer.append(t);r.pausePlay=e("."+i+"pauseplay a",r.controlsContainer)}else{r.append(t);r.pausePlay=e("."+i+"pauseplay a",r)}v.pausePlay.update(r.vars.slideshow?i+"pause":i+"play");r.pausePlay.bind(u,function(t){t.preventDefault();if(a===""||a===t.type)if(e(this).hasClass(i+"pause")){r.manualPause=!0;r.manualPlay=!1;r.pause()}else{r.manualPause=!1;r.manualPlay=!0;r.play()}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(e){e==="play"?r.pausePlay.removeClass(i+"pause").addClass(i+"play").html(r.vars.playText):r.pausePlay.removeClass(i+"play").addClass(i+"pause").html(r.vars.pauseText)}},touch:function(){var e,n,i,o,u,a,f=!1,d=0,v=0,m=0;if(!s){t.addEventListener("touchstart",g,!1);function g(s){if(r.animating)s.preventDefault();else if(window.navigator.msPointerEnabled||s.touches.length===1){r.pause();o=l?r.h:r.w;a=Number(new Date);d=s.touches[0].pageX;v=s.touches[0].pageY;i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o;e=l?v:d;n=l?d:v;t.addEventListener("touchmove",y,!1);t.addEventListener("touchend",b,!1)}}function y(t){d=t.touches[0].pageX;v=t.touches[0].pageY;u=l?e-v:e-d;f=l?Math.abs(u)s){t.preventDefault();if(!p&&r.transitions){r.vars.animationLoop||(u/=r.currentSlide===0&&u<0||r.currentSlide===r.last&&u>0?Math.abs(u)/o+2:1);r.setProps(i+u,"setTouch")}}}function b(s){t.removeEventListener("touchmove",y,!1);if(r.animatingTo===r.currentSlide&&!f&&u!==null){var l=c?-u:u,h=l>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(h)&&(Number(new Date)-a<550&&Math.abs(l)>50||Math.abs(l)>o/2)?r.flexAnimate(h,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}t.removeEventListener("touchend",b,!1);e=null;n=null;u=null;i=null}}else{t.style.msTouchAction="none";t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",w,!1);t._slider=r;t.addEventListener("MSGestureChange",E,!1);t.addEventListener("MSGestureEnd",S,!1);function w(e){e.stopPropagation();if(r.animating)e.preventDefault();else{r.pause();t._gesture.addPointer(e.pointerId);m=0;o=l?r.h:r.w;a=Number(new Date);i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o}}function E(e){e.stopPropagation();var n=e.target._slider;if(!n)return;var r=-e.translationX,s=-e.translationY;m+=l?s:r;u=m;f=l?Math.abs(m)500){e.preventDefault();if(!p&&n.transitions){n.vars.animationLoop||(u=m/(n.currentSlide===0&&m<0||n.currentSlide===n.last&&m>0?Math.abs(m)/o+2:1));n.setProps(i+u,"setTouch")}}}function S(t){t.stopPropagation();var r=t.target._slider;if(!r)return;if(r.animatingTo===r.currentSlide&&!f&&u!==null){var s=c?-u:u,l=s>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(l)&&(Number(new Date)-a<550&&Math.abs(s)>50||Math.abs(s)>o/2)?r.flexAnimate(l,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}e=null;n=null;u=null;i=null;m=0}}},resize:function(){if(!r.animating&&r.is(":visible")){h||r.doMath();if(p)v.smoothHeight();else if(h){r.slides.width(r.computedW);r.update(r.pagingCount);r.setProps()}else if(l){r.viewport.height(r.h);r.setProps(r.h,"setTotal")}else{r.vars.smoothHeight&&v.smoothHeight();r.newSlides.width(r.computedW
);r.setProps(r.computedW,"setTotal")}}},smoothHeight:function(e){if(!l||p){var t=p?r:r.viewport;e?t.animate({height:r.slides.eq(r.animatingTo).height()},e):t.height(r.slides.eq(r.animatingTo).height())}},sync:function(t){var n=e(r.vars.sync).data("flexslider"),i=r.animatingTo;switch(t){case"animate":n.flexAnimate(i,r.vars.pauseOnAction,!1,!0);break;case"play":!n.playing&&!n.asNav&&n.play();break;case"pause":n.pause()}},uniqueID:function(t){t.find("[id]").each(function(){var t=e(this);t.attr("id",t.attr("id")+"_clone")});return t},pauseInvisible:{visProp:null,init:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t0?setTimeout(r.play,r.vars.initDelay):r.play()})}},isHidden:function(){return document[v.pauseInvisible.visProp]||!1}},setToClearWatchedEvent:function(){clearTimeout(f);f=setTimeout(function(){a=""},3e3)}};r.flexAnimate=function(t,n,s,u,a){!r.vars.animationLoop&&t!==r.currentSlide&&(r.direction=t>r.currentSlide?"next":"prev");d&&r.pagingCount===1&&(r.direction=r.currentItemr.limit&&r.visible!==1?r.limit:b}else r.currentSlide===0&&t===r.count-1&&r.vars.animationLoop&&r.direction!=="next"?y=c?(r.count+r.cloneOffset)*m:0:r.currentSlide===r.last&&t===0&&r.vars.animationLoop&&r.direction!=="prev"?y=c?0:(r.count+1)*m:y=c?(r.count-1-t+r.cloneOffset)*m:(t+r.cloneOffset)*m;r.setProps(y,"",r.vars.animationSpeed);if(r.transitions){if(!r.vars.animationLoop||!r.atEnd){r.animating=!1;r.currentSlide=r.animatingTo}r.container.unbind("webkitTransitionEnd transitionend");r.container.bind("webkitTransitionEnd transitionend",function(){r.wrapup(m)})}else r.container.animate(r.args,r.vars.animationSpeed,r.vars.easing,function(){r.wrapup(m)})}else if(!o){r.slides.eq(r.currentSlide).css({zIndex:1}).animate({opacity:0},r.vars.animationSpeed,r.vars.easing);r.slides.eq(t).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing,r.wrapup)}else{r.slides.eq(r.currentSlide).css({opacity:0,zIndex:1});r.slides.eq(t).css({opacity:1,zIndex:2});r.wrapup(m)}r.vars.smoothHeight&&v.smoothHeight(r.vars.animationSpeed)}};r.wrapup=function(e){!p&&!h&&(r.currentSlide===0&&r.animatingTo===r.last&&r.vars.animationLoop?r.setProps(e,"jumpEnd"):r.currentSlide===r.last&&r.animatingTo===0&&r.vars.animationLoop&&r.setProps(e,"jumpStart"));r.animating=!1;r.currentSlide=r.animatingTo;r.vars.after(r)};r.animateSlides=function(){!r.animating&&m&&r.flexAnimate(r.getTarget("next"))};r.pause=function(){clearInterval(r.animatedSlides);r.animatedSlides=null;r.playing=!1;r.vars.pausePlay&&v.pausePlay.update("play");r.syncExists&&v.sync("pause")};r.play=function(){r.playing&&clearInterval(r.animatedSlides);r.animatedSlides=r.animatedSlides||setInterval(r.animateSlides,r.vars.slideshowSpeed);r.started=r.playing=!0;r.vars.pausePlay&&v.pausePlay.update("pause");r.syncExists&&v.sync("play")};r.stop=function(){r.pause();r.stopped=!0};r.canAdvance=function(e,t){var n=d?r.pagingCount-1:r.last;return t?!0:d&&r.currentItem===r.count-1&&e===0&&r.direction==="prev"?!0:d&&r.currentItem===0&&e===r.pagingCount-1&&r.direction!=="next"?!1:e===r.currentSlide&&!d?!1:r.vars.animationLoop?!0:r.atEnd&&r.currentSlide===0&&e===n&&r.direction!=="next"?!1:r.atEnd&&r.currentSlide===n&&e===0&&r.direction==="next"?!1:!0};r.getTarget=function(e){r.direction=e;return e==="next"?r.currentSlide===r.last?0:r.currentSlide+1:r.currentSlide===0?r.last:r.currentSlide-1};r.setProps=function(e,t,n){var i=function(){var n=e?e:(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo,i=function(){if(h)return t==="setTouch"?e:c&&r.animatingTo===r.last?0:c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:r.animatingTo===r.last?r.limit:n;switch(t){case"setTotal":return c?(r.count-1-r.currentSlide+r.cloneOffset)*e:(r.currentSlide+r.cloneOffset)*e;case"setTouch":return c?e:e;case"jumpEnd":return c?e:r.count*e;case"jumpStart":return c?r.count*e:e;default:return e}}();return i*-1+"px"}();if(r.transitions){i=l?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)";n=n!==undefined?n/1e3+"s":"0s";r.container.css("-"+r.pfx+"-transition-duration",n);r.container.css("transition-duration",n)}r.args[r.prop]=i;(r.transitions||n===undefined)&&r.container.css(r.args);r.container.css("transform",i)};r.setup=function(t){if(!p){var n,s;if(t==="init"){r.viewport=e('').css({overflow:"hidden",position:"relative"}).appendTo(r).append(r.container);r.cloneCount=0;r.cloneOffset=0;if(c){s=e.makeArray(r.slides).reverse();r.slides=e(s);r.container.empty().append(r.slides)}}if(r.vars.animationLoop&&!h){r.cloneCount=2;r.cloneOffset=1;t!=="init"&&r.container.find(".clone").remove();r.container.append(r.slides.first().clone().addClass("clone").attr("aria-hidden","true")).prepend(r.slides.last().clone().addClass("clone").attr("aria-hidden","true"));v.uniqueID(r.slides.first().clone().addClass("clone")).appendTo(r.container);v.uniqueID(r.slides.last().clone().addClass("clone")).prependTo(r.container)}r.newSlides=e(r.vars.selector,r);n=c?r.count-1-r.currentSlide+r.cloneOffset:r.currentSlide+r.cloneOffset;if(l&&!h){r.container.height((r.count+r.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){r.newSlides.css({display:"block"});r.doMath();r.viewport.height(r.h);r.setProps(n*r.h,"init")},t==="init"?100:0)}else{r.container.width((r.count+r.cloneCount)*200+"%");r.setProps(n*r.computedW,"init");setTimeout(function(){r.doMath();r.newSlides.css({width:r.computedW,"float":"left",display:"block"});r.vars.smoothHeight&&v.smoothHeight()},t==="init"?100:0)}}else{r.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"});t==="init"&&(o?r.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+r.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(r.currentSlide).css({opacity:1,zIndex:2}):r.slides.css({opacity:0,display:"block",zIndex:1}).eq(r.currentSlide).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing));r.vars.smoothHeight&&v.smoothHeight()}h||r.slides.removeClass(i+"active-slide").eq(r.currentSlide).addClass(i+"active-slide");r.vars.init(r)};r.doMath=function(){var e=r.slides.first(),t=r.vars.itemMargin,n=r.vars.minItems,i=r.vars.maxItems;r.w=r.viewport===undefined?r.width():r.viewport.width();r.h=e.height();r.boxPadding=e.outerWidth()-e.width();if(h){r.itemT=r.vars.itemWidth+t;r.minW=n?n*r.itemT:r.w;r.maxW=i?i*r.itemT-t:r.w;r.itemW=r.minW>r.w?(r.w-t*(n-1))/n:r.maxWr.w?r.w:r.vars.itemWidth;r.visible=Math.floor(r.w/r.itemW);r.move=r.vars.move>0&&r.vars.mover.w?r.itemW*(r.count-1)+t*(r.count-1):(r.itemW+t)*r.count-r.w-t}else{r.itemW=r.w;r.pagingCount=r.count;r.last=r.count-1}r.computedW=r.itemW-r.boxPadding};r.update=function(e,t){r.doMath();if(!h){er.controlNav.length)v.controlNav.update("add");else if(t==="remove"&&!h||r.pagingCountr.last){r.currentSlide-=1;r.animatingTo-=1}v.controlNav.update("remove",r.last)}r.vars.directionNav&&v.directionNav.update()};r.addSlide=function(t,n){var i=e(t);r.count+=1;r.last=r.count-1;l&&c?n!==undefined?r.slides.eq(r.count-n).after(i):r.container.prepend(i):n!==undefined?r.slides.eq(n).before(i):r.container.append(i);r.update(n,"add");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.added(r)};r.removeSlide=function(t){var n=isNaN(t)?r.slides.index(e(t)):t;r.count-=1;r.last=r.count-1;isNaN(t)?e(t,r.slides).remove():l&&c?r.slides.eq(r.last).remove():r.slides.eq(t).remove();r.doMath();r.update(n,"remove");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.removed(r)};v.init()};e(window).blur(function(e){focused=!1}).focus(function(e){focused=!0});e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}};e.fn.flexslider=function(t){t===undefined&&(t={});if(typeof t=="object")return this.each(function(){var n=e(this),r=t.selector?t.selector:".slides > li",i=n.find(r);if(i.length===1&&t.allowOneSlide===!0||i.length===0){i.fadeIn(400);t.start&&t.start(n)}else n.data("flexslider")===undefined&&new e.flexslider(this,t)});var n=e(this).data("flexslider");switch(t){case"play":n.play();break;case"pause":n.pause();break;case"stop":n.stop();break;case"next":n.flexAnimate(n.getTarget("next"),!0);break;case"prev":case"previous":n.flexAnimate(n.getTarget("prev"),!0);break;default:typeof t=="number"&&n.flexAnimate(t,!0)}}})(jQuery);
// source --> https://givegetgigs.com/wp-content/plugins/rewardsystem/admin/js/jquery.tipsy.js?ver=85ae72a5a07798878e5fcbf818ef0f2a
// tipsy, facebook style tooltips for jquery
// version 1.0.0a
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// released under the MIT license
(function ($) {
function maybeCall(thing, ctx) {
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
}
;
function isElementInDOM(ele) {
while (ele = ele.parentNode) {
if (ele == document)
return true;
}
return false;
}
;
function Tipsy(element, options) {
this.$element = $(element);
this.options = options;
this.enabled = true;
this.fixTitle();
}
;
Tipsy.prototype = {
show: function () {
var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
var pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
});
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight,
gravity = maybeCall(this.options.gravity, this.$element[0]);
var tp;
switch (gravity.charAt(0)) {
case 'n':
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 's':
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 'e':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
break;
case 'w':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
break;
}
if (gravity.length == 2) {
if (gravity.charAt(1) == 'w') {
tp.left = pos.left + pos.width / 2 - 15;
} else {
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
}
}
$tip.css(tp).addClass('tipsy-' + gravity);
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
if (this.options.className) {
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
}
if (this.options.fade) {
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
} else {
$tip.css({visibility: 'visible', opacity: this.options.opacity});
}
}
},
hide: function () {
if (this.options.fade) {
this.tip().stop().fadeOut(function () {
$(this).remove();
});
} else {
this.tip().remove();
}
},
fixTitle: function () {
var $e = this.$element;
if ($e.attr('title') || typeof ($e.attr('original-title')) != 'string') {
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
}
},
getTitle: function () {
var title, $e = this.$element, o = this.options;
this.fixTitle();
var title, o = this.options;
if (typeof o.title == 'string') {
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
} else if (typeof o.title == 'function') {
title = o.title.call($e[0]);
}
title = ('' + title).replace(/(^\s*|\s*$)/, "");
return title || o.fallback;
},
tip: function () {
if (!this.$tip) {
this.$tip = $('').html('');
this.$tip.data('tipsy-pointee', this.$element[0]);
}
return this.$tip;
},
validate: function () {
if (!this.$element[0].parentNode) {
this.hide();
this.$element = null;
this.options = null;
}
},
enable: function () {
this.enabled = true;
},
disable: function () {
this.enabled = false;
},
toggleEnabled: function () {
this.enabled = !this.enabled;
}
};
$.fn.tipsy = function (options) {
if (options === true) {
return this.data('tipsy');
} else if (typeof options == 'string') {
var tipsy = this.data('tipsy');
if (tipsy)
tipsy[options]();
return this;
}
options = $.extend({}, $.fn.tipsy.defaults, options);
function get(ele) {
var tipsy = $.data(ele, 'tipsy');
if (!tipsy) {
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
$.data(ele, 'tipsy', tipsy);
}
return tipsy;
}
function enter() {
var tipsy = get(this);
tipsy.hoverState = 'in';
if (options.delayIn == 0) {
tipsy.show();
} else {
tipsy.fixTitle();
setTimeout(function () {
if (tipsy.hoverState == 'in')
tipsy.show();
}, options.delayIn);
}
}
;
function leave() {
var tipsy = get(this);
tipsy.hoverState = 'out';
if (options.delayOut == 0) {
tipsy.hide();
} else {
setTimeout(function () {
if (tipsy.hoverState == 'out')
tipsy.hide();
}, options.delayOut);
}
}
;
if (!options.live)
this.each(function () {
get(this);
});
if (options.trigger != 'manual') {
var eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
if (options.live) {
$(this.context).on(eventIn, this.selector, enter).on(eventOut, this.selector, leave);
} else {
this.on(eventIn, enter).on(eventOut, leave);
}
}
return this;
};
$.fn.tipsy.defaults = {
className: null,
delayIn: 0,
delayOut: 0,
fade: false,
fallback: '',
gravity: 'n',
html: false,
live: false,
offset: 0,
opacity: 0.8,
title: 'title',
trigger: 'hover'
};
$.fn.tipsy.revalidate = function () {
$('.tipsy').each(function () {
var pointee = $.data(this, 'tipsy-pointee');
if (!pointee || !isElementInDOM(pointee)) {
$(this).remove();
}
});
};
// Overwrite this method to provide options on a per-element basis.
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
// (remember - do not modify 'options' in place!)
$.fn.tipsy.elementOptions = function (ele, options) {
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
};
$.fn.tipsy.autoNS = function () {
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
};
$.fn.tipsy.autoWE = function () {
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
};
/**
* yields a closure of the supplied parameters, producing a function that takes
* no arguments and is suitable for use as an autogravity function like so:
*
* @param margin (int) - distance from the viewable region edge that an
* element should be before setting its tooltip's gravity to be away
* from that edge.
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
* if there are no viewable region edges effecting the tooltip's
* gravity. It will try to vary from this minimally, for example,
* if 'sw' is preferred and an element is near the right viewable
* region edge, but not the top edge, it will set the gravity for
* that element's tooltip to be 'se', preserving the southern
* component.
*/
$.fn.tipsy.autoBounds = function (margin, prefer) {
return function () {
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
boundTop = $(document).scrollTop() + margin,
boundLeft = $(document).scrollLeft() + margin,
$this = $(this);
if ($this.offset().top < boundTop)
dir.ns = 'n';
if ($this.offset().left < boundLeft)
dir.ew = 'w';
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin)
dir.ew = 'e';
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin)
dir.ns = 's';
return dir.ns + (dir.ew ? dir.ew : '');
}
};
})(jQuery);
// source --> https://givegetgigs.com/wp-content/plugins/rewardsystem/admin/js/jscolor/jscolor.js?ver=85ae72a5a07798878e5fcbf818ef0f2a
/**
* jscolor, JavaScript Color Picker
*
* @version 1.4.1
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
* @author Jan Odvarko, http://odvarko.cz
* @created 2008-06-15
* @updated 2013-04-08
* @link http://jscolor.com
*/
var jscolor = {
dir : '', // location of jscolor directory (leave empty to autodetect)
bindClass : 'color', // class name
binding : true, // automatic binding via
preloading : true, // use image preloading?
install : function() {
jscolor.addEvent(window, 'load', jscolor.init);
},
init : function() {
if(jscolor.binding) {
jscolor.bind();
}
if(jscolor.preloading) {
jscolor.preload();
}
},
getDir : function() {
if(!jscolor.dir) {
var detected = jscolor.detectDir();
jscolor.dir = detected!==false ? detected : 'jscolor/';
}
return jscolor.dir;
},
detectDir : function() {
var base = location.href;
var e = document.getElementsByTagName('base');
for(var i=0; i vs[a] ?
(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
tp[a],
-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
];
}
drawPicker(pp[a], pp[b]);
}
};
this.importColor = function() {
if(!valueElement) {
this.exportColor();
} else {
if(!this.adjust) {
if(!this.fromString(valueElement.value, leaveValue)) {
styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
styleElement.style.color = styleElement.jscStyle.color;
this.exportColor(leaveValue | leaveStyle);
}
} else if(!this.required && /^\s*$/.test(valueElement.value)) {
valueElement.value = '';
styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
styleElement.style.color = styleElement.jscStyle.color;
this.exportColor(leaveValue | leaveStyle);
} else if(this.fromString(valueElement.value)) {
// OK
} else {
this.exportColor();
}
}
};
this.exportColor = function(flags) {
if(!(flags & leaveValue) && valueElement) {
var value = this.toString();
if(this.caps) { value = value.toUpperCase(); }
if(this.hash) { value = '#'+value; }
valueElement.value = value;
}
if(!(flags & leaveStyle) && styleElement) {
styleElement.style.backgroundImage = "none";
styleElement.style.backgroundColor =
'#'+this.toString();
styleElement.style.color =
0.213 * this.rgb[0] +
0.715 * this.rgb[1] +
0.072 * this.rgb[2]
< 0.5 ? '#FFF' : '#000';
}
if(!(flags & leavePad) && isPickerOwner()) {
redrawPad();
}
if(!(flags & leaveSld) && isPickerOwner()) {
redrawSld();
}
};
this.fromHSV = function(h, s, v, flags) { // null = don't change
if(h !== null) { h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h)); }
if(s !== null) { s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s)); }
if(v !== null) { v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v)); }
this.rgb = HSV_RGB(
h===null ? this.hsv[0] : (this.hsv[0]=h),
s===null ? this.hsv[1] : (this.hsv[1]=s),
v===null ? this.hsv[2] : (this.hsv[2]=v)
);
this.exportColor(flags);
};
this.fromRGB = function(r, g, b, flags) { // null = don't change
if(r !== null) { r = Math.max(0.0, Math.min(1.0, r)); }
if(g !== null) { g = Math.max(0.0, Math.min(1.0, g)); }
if(b !== null) { b = Math.max(0.0, Math.min(1.0, b)); }
var hsv = RGB_HSV(
r===null ? this.rgb[0] : r,
g===null ? this.rgb[1] : g,
b===null ? this.rgb[2] : b
);
if(hsv[0] !== null) {
this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0]));
}
if(hsv[2] !== 0) {
this.hsv[1] = hsv[1]===null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1]));
}
this.hsv[2] = hsv[2]===null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2]));
// update RGB according to final HSV, as some values might be trimmed
var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
this.rgb[0] = rgb[0];
this.rgb[1] = rgb[1];
this.rgb[2] = rgb[2];
this.exportColor(flags);
};
this.fromString = function(hex, flags) {
var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
if(!m) {
return false;
} else {
if(m[1].length === 6) { // 6-char notation
this.fromRGB(
parseInt(m[1].substr(0,2),16) / 255,
parseInt(m[1].substr(2,2),16) / 255,
parseInt(m[1].substr(4,2),16) / 255,
flags
);
} else { // 3-char notation
this.fromRGB(
parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
flags
);
}
return true;
}
};
this.toString = function() {
return (
(0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
(0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
(0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
);
};
function RGB_HSV(r, g, b) {
var n = Math.min(Math.min(r,g),b);
var v = Math.max(Math.max(r,g),b);
var m = v - n;
if(m === 0) { return [ null, 0, v ]; }
var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
return [ h===6?0:h, m/v, v ];
}
function HSV_RGB(h, s, v) {
if(h === null) { return [ v, v, v ]; }
var i = Math.floor(h);
var f = i%2 ? h-i : 1-(h-i);
var m = v * (1 - s);
var n = v * (1 - s*f);
switch(i) {
case 6:
case 0: return [v,n,m];
case 1: return [n,v,m];
case 2: return [m,v,n];
case 3: return [m,n,v];
case 4: return [n,m,v];
case 5: return [v,m,n];
}
}
function removePicker() {
delete jscolor.picker.owner;
document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
}
function drawPicker(x, y) {
if(!jscolor.picker) {
jscolor.picker = {
box : document.createElement('div'),
boxB : document.createElement('div'),
pad : document.createElement('div'),
padB : document.createElement('div'),
padM : document.createElement('div'),
sld : document.createElement('div'),
sldB : document.createElement('div'),
sldM : document.createElement('div'),
btn : document.createElement('div'),
btnS : document.createElement('span'),
btnT : document.createTextNode(THIS.pickerCloseText)
};
for(var i=0,segSize=4; i